package com.gf.test1;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import redis.clients.jedis.Jedis;

public class Test1 {

	public static void main(String[] args) {
		try {
			Jedis jedis = new Jedis("10.2.130.228", 6379);
			System.out.println(111);
			Map<Jedis, String> connectionPool = new HashMap<Jedis, String>();

			for (int poolInd = 5; poolInd > 0; poolInd--) {
				jedis = new Jedis("10.2.130.228", 6379);
				connectionPool.put(jedis, "AVAILABLE");
			}

			jedis.close();
			int i=0;
			for (Entry<Jedis, String> entry : connectionPool.entrySet()) {
				synchronized (entry) {
					//if (entry.getValue() == "AVAILABLE") {
						//entry.setValue("NOTAVAILABLE");
						System.out.println(i);
						System.out.println(entry.getKey());
					//}
				}
				i++;
			}

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			System.out.println("test1 finally------------------------");
		}
	}

}
